package com.example.he.p0204_myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class P0204_MyApplication extends AppCompatActivity {
    //声明MyApplication对象
    private MyApplication app;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.p0204_myapplication);
        //获得MyApplication对象
        app = (MyApplication)getApplication();
        //获取进程中Name全局变量的值
        Log.d("应用程序Name原来的值为：", app.getName());
        //修改Name的值
        app.setName("赵克玲");
        //Name的值改变
        Log.d("应用程序Name修改后的值为：", app.getName());
    }
}
